Skip to content

Conversation

@unstubbable
Copy link
Collaborator

@unstubbable unstubbable commented Jan 8, 2026

When renderModelDestructive unwraps a lazy element and subsequently calls renderModelDestructive again with the resolved model, we should preserve the parent connection so that cyclic references can be serialized properly. This can occur in an advanced scenario where the result from the Flight Client is serialized again with the Flight Server, e.g. for slicing a precomputed payload into multiple parts.

Note: The added test only fails when run with --prod. In dev mode, the component info outlining prevents the issue from occurring.

Fails with:

```
TypeError: Converting circular structure to JSON
 --> starting at object with constructor 'Object'
 --- property 'self' closes the circle
```
@meta-cla meta-cla bot added the CLA Signed label Jan 8, 2026
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Jan 8, 2026
@react-sizebot
Copy link

Comparing: d6cae44...ee803e6

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 607.60 kB 607.60 kB = 107.53 kB 107.53 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 666.83 kB 666.83 kB = 117.42 kB 117.42 kB
facebook-www/ReactDOM-prod.classic.js = 692.91 kB 692.91 kB = 121.92 kB 121.92 kB
facebook-www/ReactDOM-prod.modern.js = 683.34 kB 683.34 kB = 120.31 kB 120.31 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against ee803e6

Copy link
Collaborator

@gnoff gnoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This forks the handling of lazy object rendering depending on whether it is outlined or inlined. But I think this is right. If you inline the lazy then you want to preserve the chain of object deduplication through this boundary and thus need the parent property and key. If you are outlining the lazy then you can't preserve the chain and you just rend from a new root. I don't know why it was inlined with an empty root in the first place.

@unstubbable unstubbable merged commit 6baff7a into facebook:main Jan 16, 2026
240 checks passed
@unstubbable unstubbable deleted the fix-cycle-bug branch January 16, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants